'use client';
import Left from '@/components/Left';
import Right from '@/components/Right';
import { SearchItem } from '@/components/searchItem';
import store from '@/store';
import { useRef } from 'react';
import { Provider } from 'react-redux';
interface Props {
	children: React.ReactNode;
}

const LayoutHome: React.FC<Props> = ({ children }) => {
	const bearchRef = useRef(null);
	const handleStop = () => {
		//@ts-ignore
		bearchRef.current?.handleStop?.(); // 调用 B 中暴露的函数
	};
	const handleClickData = (isnew: boolean, id: string) => {
		//@ts-ignore
		bearchRef.current?.handleClickData?.(isnew, id);
	};
	return (
		<Provider store={store}>
			<div className="flex h-full w-screen">
				<Left handleClickData={handleClickData}></Left>
				<main className="h-screen   flex-1 relative bg-gray-100 right flex flex-col">
					{children}
					<SearchItem ref={bearchRef}></SearchItem>
				</main>
			</div>
		</Provider>
	);
};

export default LayoutHome;
